home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / pas_all.zip / TI424.ASC < prev    next >
Text File  |  1991-09-11  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  TURBO PASCAL                           NUMBER  :  424
  9.   VERSION  :  4.0
  10.        OS  :  MS-DOS, PC-DOS
  11.      DATE  :  APRIL 1, 1988                            PAGE  :  1/2
  12.  
  13.     TITLE  :  MODIFYING THE ASPECT RATIO IN THE GRAPH UNIT
  14.  
  15.  
  16.  
  17.  
  18.   {****************************************************************
  19.   The  .BGI files  supplied with  the Graph  unit declare an Aspect
  20.   Ratio constant  which is used  to draw circles  and arc segments.
  21.   For some applications it is  necessary to alter the aspect ratio.
  22.   One such application results when trying to perform a screen dump
  23.   to the  printer. In quad-density graphics  printing, it is useful
  24.   to redefine the  aspect ratio  so  the  displayed results will be
  25.   circular instead of ellipsoid.
  26.  
  27.   The following program demonstrates how a programmer can alter the
  28.   predefined  Xasp element  of the  aspect ratio  and to obtain the
  29.   current  value.  Note  that  the   Graph  unit  already  has  the
  30.   procedure for GetAspectRatio.
  31.   ****************************************************************}
  32.  
  33.  
  34.  
  35.   program ChangeAspectRatio;
  36.  
  37.   uses
  38.     Crt, Graph;
  39.  
  40.   function GetAspectX : word;
  41.   { Return the current aspect ratio element Xasp }
  42.   begin
  43.     GetAspectX := word(Ptr(Seg(GraphFreeMemPtr),
  44.                        Ofs(GraphFreeMemPtr)+277)^);
  45.   end;
  46.  
  47.   procedure SetAspectRatio(NewAspect : word);
  48.   { Set the current aspect ratio element Xasp }
  49.   begin
  50.     word(Ptr(Seg(GraphFreeMemPtr),
  51.              Ofs(GraphFreeMemPtr)+277)^) := NewAspect;
  52.   end;
  53.  
  54.   var
  55.     GraphDriver, GraphMode : integer;
  56.     Ch : char;
  57.     S : String;
  58.  
  59.   begin
  60.     DirectVideo := false;
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  TURBO PASCAL                           NUMBER  :  424
  75.   VERSION  :  4.0
  76.        OS  :  MS-DOS, PC-DOS
  77.      DATE  :  APRIL 1, 1988                            PAGE  :  2/2
  78.  
  79.     TITLE  :  MODIFYING THE ASPECT RATIO IN THE GRAPH UNIT
  80.  
  81.  
  82.  
  83.  
  84.     GraphDriver := Detect;
  85.     InitGraph(GraphDriver, GraphMode, '');
  86.     Str(GetAspectX, S);
  87.     S := 'The initial aspect ratio was ' + S;
  88.     OutTextXY(1,1, S);
  89.     Circle((GetMaxX Div 2), (GetMaxY Div 4), (GetMaxY div 4));
  90.     SetAspectRatio(5000);
  91.     Circle((GetMaxX Div 2), 3*(GetMaxY Div 4), (GetMaxY div 4));
  92.     Str(GetAspectX, S);
  93.     S := 'Now the aspect ratio is ' + S;
  94.     OutTextXY(1,(GetMaxY - 10), S);
  95.     Ch := ReadKey;
  96.     CloseGraph;
  97.   end.
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.